home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / addres / address.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-05-07  |  49.8 KB  |  1,683 lines

  1. VERSION 2.00
  2. Begin Form Address 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Mike's Address"
  5.    ClientHeight    =   5355
  6.    ClientLeft      =   2115
  7.    ClientTop       =   1410
  8.    ClientWidth     =   5175
  9.    Height          =   6045
  10.    Icon            =   ADDRESS.FRX:0000
  11.    Left            =   2055
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   5355
  15.    ScaleWidth      =   5175
  16.    Top             =   780
  17.    Width           =   5295
  18.    Begin Timer Timer1 
  19.       Enabled         =   0   'False
  20.       Interval        =   1000
  21.       Left            =   4560
  22.       Top             =   2520
  23.    End
  24.    Begin SSCommand Command3D3 
  25.       BevelWidth      =   4
  26.       Caption         =   "&Voice"
  27.       Font3D          =   3  'Inset w/light shading
  28.       Height          =   375
  29.       Left            =   120
  30.       TabIndex        =   34
  31.       Top             =   4920
  32.       Width           =   855
  33.    End
  34.    Begin ListBox List2 
  35.       FontBold        =   -1  'True
  36.       FontItalic      =   0   'False
  37.       FontName        =   "Arial"
  38.       FontSize        =   8.25
  39.       FontStrikethru  =   0   'False
  40.       FontUnderline   =   0   'False
  41.       Height          =   450
  42.       Left            =   1080
  43.       TabIndex        =   11
  44.       Top             =   4725
  45.       Width           =   3975
  46.    End
  47.    Begin ListBox List1 
  48.       FontBold        =   -1  'True
  49.       FontItalic      =   0   'False
  50.       FontName        =   "Arial"
  51.       FontSize        =   8.25
  52.       FontStrikethru  =   0   'False
  53.       FontUnderline   =   0   'False
  54.       Height          =   3180
  55.       Left            =   5280
  56.       TabIndex        =   27
  57.       TabStop         =   0   'False
  58.       Top             =   480
  59.       Visible         =   0   'False
  60.       Width           =   1215
  61.    End
  62.    Begin CommandButton Command1 
  63.       Caption         =   "|>"
  64.       FontBold        =   -1  'True
  65.       FontItalic      =   0   'False
  66.       FontName        =   "MS Serif"
  67.       FontSize        =   9.75
  68.       FontStrikethru  =   0   'False
  69.       FontUnderline   =   0   'False
  70.       Height          =   275
  71.       Index           =   3
  72.       Left            =   4875
  73.       TabIndex        =   26
  74.       TabStop         =   0   'False
  75.       Top             =   4440
  76.       Visible         =   0   'False
  77.       Width           =   300
  78.    End
  79.    Begin CommandButton Command1 
  80.       Caption         =   ">"
  81.       FontBold        =   -1  'True
  82.       FontItalic      =   0   'False
  83.       FontName        =   "MS Serif"
  84.       FontSize        =   9.75
  85.       FontStrikethru  =   0   'False
  86.       FontUnderline   =   0   'False
  87.       Height          =   275
  88.       Index           =   2
  89.       Left            =   4580
  90.       TabIndex        =   25
  91.       TabStop         =   0   'False
  92.       Top             =   4440
  93.       Visible         =   0   'False
  94.       Width           =   300
  95.    End
  96.    Begin CommandButton Command1 
  97.       Caption         =   "<"
  98.       FontBold        =   -1  'True
  99.       FontItalic      =   0   'False
  100.       FontName        =   "MS Serif"
  101.       FontSize        =   9.75
  102.       FontStrikethru  =   0   'False
  103.       FontUnderline   =   0   'False
  104.       Height          =   275
  105.       Index           =   1
  106.       Left            =   285
  107.       TabIndex        =   24
  108.       TabStop         =   0   'False
  109.       Top             =   4440
  110.       Visible         =   0   'False
  111.       Width           =   300
  112.    End
  113.    Begin CommandButton Command1 
  114.       Caption         =   "|<"
  115.       FontBold        =   -1  'True
  116.       FontItalic      =   0   'False
  117.       FontName        =   "MS Serif"
  118.       FontSize        =   9.75
  119.       FontStrikethru  =   0   'False
  120.       FontUnderline   =   0   'False
  121.       Height          =   275
  122.       Index           =   0
  123.       Left            =   0
  124.       TabIndex        =   23
  125.       TabStop         =   0   'False
  126.       Top             =   4440
  127.       Visible         =   0   'False
  128.       Width           =   300
  129.    End
  130.    Begin Data Data1 
  131.       Caption         =   "Data1"
  132.       Connect         =   ""
  133.       DatabaseName    =   ""
  134.       Exclusive       =   0   'False
  135.       Height          =   270
  136.       Left            =   0
  137.       Options         =   0
  138.       ReadOnly        =   0   'False
  139.       RecordSource    =   ""
  140.       Top             =   4440
  141.       Width           =   5175
  142.    End
  143.    Begin SSPanel Panel3D1 
  144.       Alignment       =   6  'Center - TOP
  145.       BackColor       =   &H00C0C0C0&
  146.       BevelInner      =   2  'Raised
  147.       BorderWidth     =   1
  148.       Font3D          =   3  'Inset w/light shading
  149.       FontBold        =   -1  'True
  150.       FontItalic      =   0   'False
  151.       FontName        =   "Arial"
  152.       FontSize        =   8.25
  153.       FontStrikethru  =   0   'False
  154.       FontUnderline   =   0   'False
  155.       Height          =   4455
  156.       Left            =   0
  157.       TabIndex        =   12
  158.       Top             =   0
  159.       Width           =   5175
  160.       Begin SSCommand Command3D2 
  161.          Caption         =   "&Update"
  162.          Font3D          =   3  'Inset w/light shading
  163.          FontBold        =   -1  'True
  164.          FontItalic      =   0   'False
  165.          FontName        =   "Arial"
  166.          FontSize        =   8.25
  167.          FontStrikethru  =   0   'False
  168.          FontUnderline   =   0   'False
  169.          Height          =   255
  170.          Left            =   3360
  171.          TabIndex        =   30
  172.          Top             =   0
  173.          Width           =   855
  174.       End
  175.       Begin SSCommand Command3D1 
  176.          Caption         =   "&Cancel"
  177.          Font3D          =   3  'Inset w/light shading
  178.          FontBold        =   -1  'True
  179.          FontItalic      =   0   'False
  180.          FontName        =   "Arial"
  181.          FontSize        =   8.25
  182.          FontStrikethru  =   0   'False
  183.          FontUnderline   =   0   'False
  184.          Height          =   255
  185.          Left            =   4200
  186.          TabIndex        =   31
  187.          Top             =   0
  188.          Width           =   855
  189.       End
  190.       Begin TextBox Text11 
  191.          DataField       =   "tAlpha"
  192.          DataSource      =   "Data1"
  193.          FontBold        =   -1  'True
  194.          FontItalic      =   0   'False
  195.          FontName        =   "Courier"
  196.          FontSize        =   9.75
  197.          FontStrikethru  =   0   'False
  198.          FontUnderline   =   0   'False
  199.          Height          =   360
  200.          Left            =   4200
  201.          MaxLength       =   5
  202.          TabIndex        =   5
  203.          Text            =   "tAlph"
  204.          Top             =   1680
  205.          Width           =   855
  206.       End
  207.       Begin TextBox Text10 
  208.          DataField       =   "tRegion"
  209.          DataSource      =   "Data1"
  210.          FontBold        =   -1  'True
  211.          FontItalic      =   0   'False
  212.          FontName        =   "Courier"
  213.          FontSize        =   9.75
  214.          FontStrikethru  =   0   'False
  215.          FontUnderline   =   0   'False
  216.          Height          =   360
  217.          Left            =   1800
  218.          MaxLength       =   15
  219.          TabIndex        =   7
  220.          Text            =   "tRegion"
  221.          Top             =   2280
  222.          Width           =   2175
  223.       End
  224.       Begin TextBox Text9 
  225.          DataField       =   "tPhone"
  226.          DataSource      =   "Data1"
  227.          FontBold        =   -1  'True
  228.          FontItalic      =   0   'False
  229.          FontName        =   "Courier"
  230.          FontSize        =   9.75
  231.          FontStrikethru  =   0   'False
  232.          FontUnderline   =   0   'False
  233.          Height          =   360
  234.          Left            =   120
  235.          MaxLength       =   35
  236.          TabIndex        =   10
  237.          Text            =   "tPhone"
  238.          Top             =   4080
  239.          Width           =   4935
  240.       End
  241.       Begin TextBox Text8 
  242.          DataField       =   "tInfo"
  243.          DataSource      =   "Data1"
  244.          FontBold        =   -1  'True
  245.          FontItalic      =   0   'False
  246.          FontName        =   "Courier"
  247.          FontSize        =   9.75
  248.          FontStrikethru  =   0   'False
  249.          FontUnderline   =   0   'False
  250.          Height          =   360
  251.          Left            =   120
  252.          MaxLength       =   35
  253.          TabIndex        =   9
  254.          Text            =   "tInfo"
  255.          Top             =   3480
  256.          Width           =   4935
  257.       End
  258.       Begin TextBox Text7 
  259.          DataField       =   "tMessage"
  260.          DataSource      =   "Data1"
  261.          FontBold        =   -1  'True
  262.          FontItalic      =   0   'False
  263.          FontName        =   "Courier"
  264.          FontSize        =   9.75
  265.          FontStrikethru  =   0   'False
  266.          FontUnderline   =   0   'False
  267.          Height          =   360
  268.          Left            =   120
  269.          MaxLength       =   35
  270.          TabIndex        =   8
  271.          Text            =   "tMessage"
  272.          Top             =   2880
  273.          Width           =   4935
  274.       End
  275.       Begin TextBox Text6 
  276.          DataField       =   "tZip"
  277.          DataSource      =   "Data1"
  278.          FontBold        =   -1  'True
  279.          FontItalic      =   0   'False
  280.          FontName        =   "Courier"
  281.          FontSize        =   9.75
  282.          FontStrikethru  =   0   'False
  283.          FontUnderline   =   0   'False
  284.          Height          =   360
  285.          Left            =   120
  286.          MaxLength       =   10
  287.          TabIndex        =   6
  288.          Text            =   "tZip"
  289.          Top             =   2280
  290.          Width           =   1575
  291.       End
  292.       Begin TextBox Text5 
  293.          DataField       =   "tState"
  294.          DataSource      =   "Data1"
  295.          FontBold        =   -1  'True
  296.          FontItalic      =   0   'False
  297.          FontName        =   "Courier"
  298.          FontSize        =   9.75
  299.          FontStrikethru  =   0   'False
  300.          FontUnderline   =   0   'False
  301.          Height          =   360
  302.          Left            =   3120
  303.          MaxLength       =   6
  304.          TabIndex        =   4
  305.          Text            =   "tState"
  306.          Top             =   1680
  307.          Width           =   975
  308.       End
  309.       Begin TextBox Text4 
  310.          DataField       =   "tCity"
  311.          DataSource      =   "Data1"
  312.          FontBold        =   -1  'True
  313.          FontItalic      =   0   'False
  314.          FontName        =   "Courier"
  315.          FontSize        =   9.75
  316.          FontStrikethru  =   0   'False
  317.          FontUnderline   =   0   'False
  318.          Height          =   360
  319.          Left            =   120
  320.          MaxLength       =   20
  321.          TabIndex        =   3
  322.          Text            =   "tCity"
  323.          Top             =   1680
  324.          Width           =   2895
  325.       End
  326.       Begin TextBox Text3 
  327.          DataField       =   "tStreet2"
  328.          DataSource      =   "Data1"
  329.          FontBold        =   -1  'True
  330.          FontItalic      =   0   'False
  331.          FontName        =   "Courier"
  332.          FontSize        =   9.75
  333.          FontStrikethru  =   0   'False
  334.          FontUnderline   =   0   'False
  335.          Height          =   360
  336.          Left            =   120
  337.          MaxLength       =   35
  338.          TabIndex        =   2
  339.          Text            =   "tStreet2"
  340.          Top             =   1090
  341.          Width           =   4935
  342.       End
  343.       Begin TextBox Text2 
  344.          DataField       =   "tStreet1"
  345.          DataSource      =   "Data1"
  346.          FontBold        =   -1  'True
  347.          FontItalic      =   0   'False
  348.          FontName        =   "Courier"
  349.          FontSize        =   9.75
  350.          FontStrikethru  =   0   'False
  351.          FontUnderline   =   0   'False
  352.          Height          =   360
  353.          Left            =   120
  354.          MaxLength       =   35
  355.          TabIndex        =   1
  356.          Text            =   "tStreet1"
  357.          Top             =   840
  358.          Width           =   4935
  359.       End
  360.       Begin TextBox Text1 
  361.          DataField       =   "tName"
  362.          DataSource      =   "Data1"
  363.          FontBold        =   -1  'True
  364.          FontItalic      =   0   'False
  365.          FontName        =   "Courier"
  366.          FontSize        =   9.75
  367.          FontStrikethru  =   0   'False
  368.          FontUnderline   =   0   'False
  369.          Height          =   360
  370.          Left            =   120
  371.          MaxLength       =   35
  372.          TabIndex        =   0
  373.          Text            =   "tName"
  374.          Top             =   240
  375.          Width           =   4935
  376.       End
  377.       Begin Label Label12 
  378.          AutoSize        =   -1  'True
  379.          BackStyle       =   0  'Transparent
  380.          Caption         =   "Last Update:"
  381.          FontBold        =   -1  'True
  382.          FontItalic      =   0   'False
  383.          FontName        =   "Arial"
  384.          FontSize        =   8.25
  385.          FontStrikethru  =   0   'False
  386.          FontUnderline   =   0   'False
  387.          ForeColor       =   &H00800000&
  388.          Height          =   210
  389.          Left            =   4080
  390.          TabIndex        =   29
  391.          Top             =   2040
  392.          Width           =   1020
  393.       End
  394.       Begin Label Label11 
  395.          AutoSize        =   -1  'True
  396.          BackStyle       =   0  'Transparent
  397.          Caption         =   "00-00-0000"
  398.          DataField       =   "tDate"
  399.          DataSource      =   "Data1"
  400.          FontBold        =   -1  'True
  401.          FontItalic      =   0   'False
  402.          FontName        =   "Arial"
  403.          FontSize        =   8.25
  404.          FontStrikethru  =   0   'False
  405.          FontUnderline   =   0   'False
  406.          ForeColor       =   &H00800000&
  407.          Height          =   210
  408.          Left            =   4080
  409.          TabIndex        =   28
  410.          Top             =   2280
  411.          Width           =   840
  412.       End
  413.       Begin Label Label10 
  414.          AutoSize        =   -1  'True
  415.          BackStyle       =   0  'Transparent
  416.          Caption         =   "Order:"
  417.          FontBold        =   -1  'True
  418.          FontItalic      =   0   'False
  419.          FontName        =   "Arial"
  420.          FontSize        =   8.25
  421.          FontStrikethru  =   0   'False
  422.          FontUnderline   =   0   'False
  423.          Height          =   210
  424.          Left            =   4200
  425.          TabIndex        =   22
  426.          Top             =   1440
  427.          Width           =   525
  428.       End
  429.       Begin Label Label9 
  430.          AutoSize        =   -1  'True
  431.          BackStyle       =   0  'Transparent
  432.          Caption         =   "Country:"
  433.          FontBold        =   -1  'True
  434.          FontItalic      =   0   'False
  435.          FontName        =   "Arial"
  436.          FontSize        =   8.25
  437.          FontStrikethru  =   0   'False
  438.          FontUnderline   =   0   'False
  439.          Height          =   210
  440.          Left            =   1800
  441.          TabIndex        =   21
  442.          Top             =   2040
  443.          Width           =   705
  444.       End
  445.       Begin Label Label8 
  446.          AutoSize        =   -1  'True
  447.          BackStyle       =   0  'Transparent
  448.          Caption         =   "Phone:"
  449.          FontBold        =   -1  'True
  450.          FontItalic      =   0   'False
  451.          FontName        =   "Arial"
  452.          FontSize        =   8.25
  453.          FontStrikethru  =   0   'False
  454.          FontUnderline   =   0   'False
  455.          Height          =   210
  456.          Left            =   120
  457.          TabIndex        =   20
  458.          Top             =   3840
  459.          Width           =   570
  460.       End
  461.       Begin Label Label7 
  462.          AutoSize        =   -1  'True
  463.          BackStyle       =   0  'Transparent
  464.          Caption         =   "Information:"
  465.          FontBold        =   -1  'True
  466.          FontItalic      =   0   'False
  467.          FontName        =   "Arial"
  468.          FontSize        =   8.25
  469.          FontStrikethru  =   0   'False
  470.          FontUnderline   =   0   'False
  471.          Height          =   210
  472.          Left            =   120
  473.          TabIndex        =   19
  474.          Top             =   3240
  475.          Width           =   1005
  476.       End
  477.       Begin Label Label6 
  478.          AutoSize        =   -1  'True
  479.          BackStyle       =   0  'Transparent
  480.          Caption         =   "Message:"
  481.          FontBold        =   -1  'True
  482.          FontItalic      =   0   'False
  483.          FontName        =   "Arial"
  484.          FontSize        =   8.25
  485.          FontStrikethru  =   0   'False
  486.          FontUnderline   =   0   'False
  487.          Height          =   210
  488.          Left            =   120
  489.          TabIndex        =   18
  490.          Top             =   2640
  491.          Width           =   810
  492.       End
  493.       Begin Label Label5 
  494.          AutoSize        =   -1  'True
  495.          BackStyle       =   0  'Transparent
  496.          Caption         =   "Zip Code:"
  497.          FontBold        =   -1  'True
  498.          FontItalic      =   0   'False
  499.          FontName        =   "Arial"
  500.          FontSize        =   8.25
  501.          FontStrikethru  =   0   'False
  502.          FontUnderline   =   0   'False
  503.          Height          =   210
  504.          Left            =   120
  505.          TabIndex        =   17
  506.          Top             =   2040
  507.          Width           =   780
  508.       End
  509.       Begin Label Label4 
  510.          AutoSize        =   -1  'True
  511.          BackStyle       =   0  'Transparent
  512.          Caption         =   "State:"
  513.          FontBold        =   -1  'True
  514.          FontItalic      =   0   'False
  515.          FontName        =   "Arial"
  516.          FontSize        =   8.25
  517.          FontStrikethru  =   0   'False
  518.          FontUnderline   =   0   'False
  519.          Height          =   210
  520.          Left            =   3120
  521.          TabIndex        =   16
  522.          Top             =   1440
  523.          Width           =   465
  524.       End
  525.       Begin Label Label3 
  526.          AutoSize        =   -1  'True
  527.          BackStyle       =   0  'Transparent
  528.          Caption         =   "City:"
  529.          FontBold        =   -1  'True
  530.          FontItalic      =   0   'False
  531.          FontName        =   "Arial"
  532.          FontSize        =   8.25
  533.          FontStrikethru  =   0   'False
  534.          FontUnderline   =   0   'False
  535.          Height          =   210
  536.          Left            =   120
  537.          TabIndex        =   15
  538.          Top             =   1440
  539.          Width           =   360
  540.       End
  541.       Begin Label Label2 
  542.          AutoSize        =   -1  'True
  543.          BackStyle       =   0  'Transparent
  544.          Caption         =   "Street Address:"
  545.          FontBold        =   -1  'True
  546.          FontItalic      =   0   'False
  547.          FontName        =   "Arial"
  548.          FontSize        =   8.25
  549.          FontStrikethru  =   0   'False
  550.          FontUnderline   =   0   'False
  551.          Height          =   210
  552.          Left            =   120
  553.          TabIndex        =   14
  554.          Top             =   600
  555.          Width           =   1320
  556.       End
  557.       Begin Label Label1 
  558.          AutoSize        =   -1  'True
  559.          BackStyle       =   0  'Transparent
  560.          Caption         =   "Name:"
  561.          FontBold        =   -1  'True
  562.          FontItalic      =   0   'False
  563.          FontName        =   "Arial"
  564.          FontSize        =   8.25
  565.          FontStrikethru  =   0   'False
  566.          FontUnderline   =   0   'False
  567.          Height          =   210
  568.          Left            =   120
  569.          TabIndex        =   13
  570.          Top             =   0
  571.          Width           =   510
  572.       End
  573.    End
  574.    Begin Label Label14 
  575.       DataField       =   "tVoice"
  576.       DataSource      =   "Data1"
  577.       Height          =   255
  578.       Left            =   120
  579.       TabIndex        =   33
  580.       Top             =   5040
  581.       Visible         =   0   'False
  582.       Width           =   855
  583.    End
  584.    Begin Label Label13 
  585.       AutoSize        =   -1  'True
  586.       BackStyle       =   0  'Transparent
  587.       Caption         =   "Name List:"
  588.       FontBold        =   -1  'True
  589.       FontItalic      =   0   'False
  590.       FontName        =   "Arial"
  591.       FontSize        =   8.25
  592.       FontStrikethru  =   0   'False
  593.       FontUnderline   =   0   'False
  594.       Height          =   210
  595.       Left            =   120
  596.       TabIndex        =   32
  597.       Top             =   4725
  598.       Width           =   870
  599.    End
  600.    Begin Menu MenuFile 
  601.       Caption         =   "&File"
  602.       Begin Menu MenuAddRecord 
  603.          Caption         =   "&Add Record"
  604.       End
  605.       Begin Menu MenuDeleteRecord 
  606.          Caption         =   "&Delete Record"
  607.       End
  608.       Begin Menu MenuBrowseRecords 
  609.          Caption         =   "&Browse Records"
  610.       End
  611.       Begin Menu MenuSearchRecords 
  612.          Caption         =   "&Search Records"
  613.       End
  614.       Begin Menu Hash1 
  615.          Caption         =   "-"
  616.       End
  617.       Begin Menu MenuExit 
  618.          Caption         =   "E&xit"
  619.       End
  620.    End
  621.    Begin Menu MenuEdit 
  622.       Caption         =   "&Edit"
  623.       Begin Menu MenuCut 
  624.          Caption         =   "&Cut"
  625.       End
  626.       Begin Menu MenuCopy 
  627.          Caption         =   "C&opy"
  628.       End
  629.       Begin Menu MenuPaste 
  630.          Caption         =   "&Paste"
  631.       End
  632.       Begin Menu MenuClear 
  633.          Caption         =   "C&lear"
  634.       End
  635.       Begin Menu Hash2 
  636.          Caption         =   "-"
  637.       End
  638.       Begin Menu MenuCopyAddress 
  639.          Caption         =   "Copy &Address"
  640.       End
  641.    End
  642.    Begin Menu MenuPrint 
  643.       Caption         =   "&Print"
  644.       Begin Menu MenuNameList 
  645.          Caption         =   "&Name List"
  646.       End
  647.       Begin Menu MenuNamePhoneList 
  648.          Caption         =   "Name && &Phone List"
  649.          Begin Menu MenuOneList 
  650.             Caption         =   "&One Line"
  651.          End
  652.          Begin Menu MenuTwoList 
  653.             Caption         =   "&Two Lines"
  654.          End
  655.       End
  656.    End
  657.    Begin Menu MenuVoice 
  658.       Caption         =   "V&oice"
  659.       Begin Menu MenuRecordVoice 
  660.          Caption         =   "&Record"
  661.       End
  662.       Begin Menu MenuDeleteVoice 
  663.          Caption         =   "&Delete"
  664.       End
  665.    End
  666.    Begin Menu MenuPhone 
  667.       Caption         =   "P&hone"
  668.       Begin Menu MenuDial 
  669.          Caption         =   "&Dial"
  670.       End
  671.       Begin Menu MenuSetup 
  672.          Caption         =   "&SetUp"
  673.       End
  674.    End
  675.    Begin Menu MenuDatabase 
  676.       Caption         =   "&DataBase"
  677.       Begin Menu MenuCompact 
  678.          Caption         =   "&Compact"
  679.       End
  680.    End
  681. Dim CurrRec As Long
  682. Dim DBName As String
  683. Dim SkipIt As Integer
  684. Dim CancelFlag As Integer
  685. Dim ABM As String
  686. Dim MyRec As Long
  687. Dim TotRec As Long
  688. Dim AlreadySet As Integer
  689. Dim SearchFlag As Integer
  690. Dim CallString As String
  691. Dim OkSize As Integer
  692. Sub Command1_Click (Index As Integer)
  693. 'Our Buttons try to simulate the data control buttons
  694. 'This helps to keep the recordset in order
  695. UpdateTheRecord
  696. Select Case Index
  697.     Case 0
  698.         If MyRec <> 1 Then Data1.Recordset.MoveFirst
  699.     Case 1
  700.         If MyRec <> 1 Then Data1.Recordset.MovePrevious
  701.     Case 2
  702.         If MyRec <> TotRec Then Data1.Recordset.MoveNext
  703.     Case 3
  704.         If MyRec <> TotRec Then Data1.Recordset.MoveLast
  705. End Select
  706. End Sub
  707. Sub Command3D1_Click ()
  708. CancelFlag = True       'cancelflag set to stop update
  709. If Label14.Caption <> "" Then   'make sure delete any wav file saved
  710.     xx$ = Label14.Caption
  711.     On Error Resume Next
  712.     Kill xx$
  713. End If
  714. If ABM <> "" Then   'this tells us if recordset has any records
  715.     Data1.Recordset.Bookmark = ABM
  716.     Command3D1.Visible = False
  717.     Command3D2.Visible = False
  718.     MenuAddRecord.Enabled = True
  719.     MenuDeleteRecord.Enabled = True
  720.     If SearchFlag Then
  721.         MenuSearchRecords.Enabled = False
  722.         MenuBrowseRecords.Enabled = True
  723.     Else
  724.         MenuSearchRecords.Enabled = True
  725.         MenuBrowseRecords.Enabled = False
  726.     End If
  727.     If Label14.Caption <> "" Then
  728.         Command3D3.Enabled = True
  729.     Else
  730.         Command3D3.Enabled = False
  731.     End If
  732.     List2.Visible = True
  733.     Data1.Enabled = True
  734.     ABM = ""            'must turn off bookmark after cancel
  735.     MenuAddRecord_Click
  736. End If
  737. End Sub
  738. Sub Command3D2_Click ()
  739. 'Update the added record and the name list and display
  740. 'new record in browse mode
  741.     If Data1.EditMode = 2 Then
  742.         Label11.Caption = Date$
  743.         Data1.Recordset.Update
  744.         If Data1.EditMode = 0 Then      'record written ?
  745.             Data1.Recordset.MoveLast
  746.             CurrRec = Data1.Recordset!ID
  747.             Data1.Refresh
  748.             UpdateMyList
  749.             List2.Visible = True
  750.             Data1.Recordset.FindFirst "ID = " & CStr(CurrRec)
  751.         Else
  752.             On Local Error GoTo NoNo
  753.             Data1.Recordset.FindFirst "ID = " & CStr(CurrRec)
  754.         End If
  755.         ABM = ""    'must turn off bookmark when add finished
  756.     End If
  757.     Data1.Enabled = True
  758.     MenuAddRecord.Enabled = True
  759.     MenuDeleteRecord.Enabled = True
  760.     MenuSearchRecords.Enabled = True
  761.     Command3D2.Visible = False
  762.     Command3D1.Visible = False
  763.     Exit Sub
  764. NoNo:
  765.     If Err = 3021 Then
  766.         Resume Next
  767.     Else
  768.         Resume Next
  769.     End If
  770. End Sub
  771. Sub Command3D3_Click ()
  772. 'play the voice file. It error then just exit. Don't
  773. 'cause the user alot of hassle
  774. If Label14.Caption = "" Then Exit Sub
  775. Command3D3.Enabled = False
  776. MenuVoice.Enabled = False
  777. PlayFile$ = Trim$(Label14.Caption)
  778. OpenStr$ = "open " & PlayFile$ & " alias talk"
  779. If Not MMSend%(OpenStr$) Then
  780.     Command3D3.Enabled = True       'may need to recheck label14
  781.     MenuVoice.Enabled = True
  782.     Exit Sub
  783. End If
  784. If Not MMSend%("play talk from 0") Then
  785.     X% = MMSend%("close talk")
  786.     Command3D3.Enabled = True
  787.     MenuVoice.Enabled = True
  788.     Exit Sub
  789.     Timer1.Enabled = True   'start timer to check when to close
  790. End If
  791. End Sub
  792. Sub CommandOff ()
  793. For i% = 0 To 3
  794.     Command1(i%).Visible = False
  795. Next i%
  796. AlreadySet = False
  797. End Sub
  798. Sub Data1_Error (DataErr As Integer, Response As Integer)
  799. 'Display an error if database file can't be found and exit
  800. Select Case DataErr
  801.     Case 3004
  802.         Response = 0
  803.         Msg$ = "Couldn't Find DataBase " & DBName
  804.         Beep
  805.         MsgBox Msg$, 16, ErrorMsg
  806.         End
  807.     Case 3024
  808.         Response = 0
  809.         Msg$ = "Couldn't Find File " & DBName
  810.         Beep
  811.         MsgBox Msg$, 16, ErrorMsg
  812.         End
  813. End Select
  814. End Sub
  815. Sub Data1_Reposition ()
  816. If SkipIt Then Exit Sub 'don't do anything
  817. Dim ds As dynaset
  818. Dim bm As String
  819. 'update MyRec and TotRec to try and make sure we are on
  820. 'top of things. Change caption in data1 to reflect where
  821. 'we are at...hopefully
  822. If Data1.Recordset.EOF = 0 Then
  823.     Set ds = Data1.Recordset.Clone()
  824.     bm = Data1.Recordset.Bookmark
  825.     ds.MoveFirst
  826.     MyRec = 1
  827.     While ds.Bookmark <> bm
  828.         MyRec = MyRec + 1
  829.         ds.MoveNext
  830.     Wend
  831.     ds.MoveLast
  832.     TotRec = ds.RecordCount
  833.     ds.Close
  834.     Data1.Caption = "Record " & CStr(MyRec) & " of " & CStr(TotRec)
  835. End If
  836. 'keep the listbox index up to date if possible
  837. If List1.ListCount <> 0 And Data1.Recordset.EOF = 0 And Data1.EditMode <> 2 Then
  838.     For i% = 0 To List1.ListCount - 1
  839.         If List1.List(i%) = CStr(Data1.Recordset!ID) Then
  840.             List1.ListIndex = i%
  841.             List2.ListIndex = i%
  842.             Exit For
  843.         End If
  844.     Next i%
  845. End If
  846. 'keep Comman3d3 up to date as far as enabled property
  847. If Not Timer1.Enabled Then
  848.     If Label14.Caption = "" Then
  849.         Command3D3.Enabled = False
  850.     Else
  851.         Command3D3.Enabled = True
  852.     End If
  853. End If
  854. End Sub
  855. Sub Data1_Validate (Action As Integer, Save As Integer)
  856. 'skip update if this flag set. used by cancel button in
  857. 'add mode
  858. If CancelFlag = True Then
  859.     CancelFlag = False
  860.     Save = False
  861.     Exit Sub
  862. End If
  863. Select Case Action
  864.     Case 6
  865.     Case 11                         'form unload
  866.         If Save = True Then
  867.             Beep
  868.             If MsgBox("Commit Changes before Closing?", 36, "Mike's Address") <> 6 Then
  869.                 Save = False
  870.             Else
  871.                 Label11.Caption = Date$     'make sure save new date
  872.             End If
  873.         End If
  874. End Select
  875. End Sub
  876. Sub FilterString (ts$)
  877. 'Make sure that we don't goof up SQLQ special characters
  878. 'and get them confused with our search string. The [ and
  879. '] characters are not allowed in search string.
  880. cString$ = ""
  881. If InStr(ts$, "#") Or InStr(ts$, "*") Or InStr(ts$, "?") Then
  882.     For i% = 1 To Len(ts$)
  883.         a$ = Mid$(ts$, i%, 1)
  884.         If a$ = "#" Or a$ = "*" Or a$ = "?" Then
  885.             cString$ = cString$ & "[" & a$ & "]"
  886.         Else
  887.             cString$ = cString$ & a$
  888.         End If
  889.     Next i%
  890.     ts$ = cString$
  891. End If
  892. End Sub
  893. Sub Form_Load ()
  894. Dim ds As dynaset
  895. ErrorMsg = "Mike's Address Error"
  896. If App.PrevInstance Then          'load only one
  897.     Beep
  898.     MsgBox "Mike's Address Already Running.", 16, ErrorMsg
  899.     End
  900. End If
  901. ThePath = App.Path  'ThePath is Global Variable
  902. If Right$(ThePath, 1) <> "\" Then
  903.     ThePath = ThePath & "\"
  904. End If
  905. X$ = ThePath & "Address.ini"
  906. If Not INISetup%(X$) Then   'we need an ini file
  907.     Beep
  908.     MsgBox "Unable to SetUp Initialization File.", 16, ErrorMsg
  909.     End
  910. End If
  911. 'check to see if we have wave playing device. if not then
  912. 'we just turn off a button and caption so they are not
  913. 'available to the user.
  914. If Not IsWavePlay%() Then
  915.     MenuVoice.Visible = False
  916.     Command3D3.Visible = False
  917. End If
  918. 'set the window position
  919. Default$ = "NOTOP"
  920. INIFile$ = ThePath & "Address.ini"
  921. TheTop$ = GetPPKeyString$("Position", "aTop", Default$, INIFile$)
  922. TheLeft$ = GetPPKeyString$("Position", "aLeft", Default$, INIFile$)
  923. If TheTop$ = "NOTOP" Or TheLeft$ = "NOTOP" Then
  924.     Address.Top = (Screen.Height - Address.Height) \ 2
  925.     Address.Left = (Screen.Width - Address.Width) \ 2
  926.     Address.Top = CDbl(TheTop$)
  927.     Address.Left = CDbl(TheLeft$)
  928. End If
  929. 'open up that database
  930. DBName = ThePath & "ADDRESS.MDB"
  931. Data1.DatabaseName = DBName
  932. Data1.RecordSource = "Select * From Addresses Order by tAlpha"
  933. SkipIt = True
  934. Command3D2.Visible = False
  935. Command3D1.Visible = False
  936. Data1.Refresh
  937. Address.Show
  938. 'if database empty then go to add mode
  939. If Data1.Recordset.BOF And Data1.Recordset.EOF Then
  940.     MenuAddRecord_Click
  941. Else    'else update list box and show first record
  942.     UpdateMyList
  943.     List1.ListIndex = 0
  944.     List2.ListIndex = 0
  945.     Set ds = Data1.Recordset.Clone()
  946.     ds.MoveLast
  947.     TotRec = ds.RecordCount
  948.     ds.Close
  949.     MyRec = 1
  950.     Data1.Caption = "Record " & CStr(MyRec) & " of " & CStr(TotRec)
  951.     MenuBrowseRecords.Enabled = False
  952.     If Label14.Caption = "" Then
  953.         Command3D3.Enabled = False
  954.     End If
  955. End If
  956. SkipIt = False
  957. End Sub
  958. Sub Form_Resize ()
  959. 'I like a border around my application and need the minimize
  960. 'button. This procedure lets me have the border and prevents
  961. 'the user from resizing the form. Note there is a flag
  962. 'to allow me to resize the form from code.
  963. If Address.Height <> 6045 Or Address.Width <> 5295 Then
  964.     If Address.WindowState <> 1 Then
  965.         If OkSize = False Then
  966.             Address.Height = 6045
  967.             Address.Width = 5295
  968.         End If
  969.     End If
  970. End If
  971. End Sub
  972. Sub Form_Unload (Cancel As Integer)
  973. 'make sure we close out the player if still running
  974. Y% = MMSend("close talk")   'make sure we are closed
  975. 'save form position to ini file for next start up
  976. INIFile$ = ThePath & "Address.ini"
  977. SetName$ = CStr(Address.Top)
  978. Y% = WritePPKeyString%("Position", "aTop", SetName$, INIFile$)
  979. SetName$ = CStr(Address.Left)
  980. Y% = WritePPKeyString%("Position", "aLeft", SetName$, INIFile$)
  981. End Sub
  982. Sub Label14_Click ()
  983. 'this label receives the path to the voice file
  984. End Sub
  985. Sub List2_DblClick ()
  986. If List2.ListCount = 0 Then Exit Sub
  987. TheID$ = List1.List(List2.ListIndex)
  988. If Command1(0).Visible = True Then
  989.     UpdateTheRecord
  990. End If
  991. Data1.Recordset.FindFirst "ID= " & TheID$
  992. End Sub
  993. Sub List2_KeyPress (KeyAscii As Integer)
  994. If KeyAscii = 13 Then
  995.     KeyAscii = 0
  996.     List2_DblClick
  997. End If
  998. End Sub
  999. Sub MenuAddRecord_Click ()
  1000. On Local Error GoTo cNewErr
  1001. If Command1(0).Visible Then
  1002.     UpdateTheRecord
  1003. End If
  1004. ABM = ""
  1005. 'save the following values for future use
  1006. CurrRec = Data1.Recordset!ID
  1007. ABM = Data1.Recordset.Bookmark
  1008. Data1.Recordset.AddNew
  1009. Data1.Caption = "New Record"
  1010. List2.Visible = False
  1011. Data1.Enabled = False
  1012. MenuAddRecord.Enabled = False
  1013. MenuDeleteRecord.Enabled = False
  1014. MenuBrowseRecords.Enabled = False
  1015. MenuSearchRecords.Enabled = False
  1016. Command3D2.Visible = True
  1017. Command3D1.Visible = True
  1018. Command3D3.Enabled = False
  1019. Text1.SetFocus
  1020. Exit Sub
  1021. cNewErr:
  1022.     'If Err = 3021 Then
  1023.      '   CurrRec = -1
  1024.         Resume Next
  1025.     'Else
  1026.         'Resume cnewEnd
  1027.     'End If
  1028. cnewEnd:
  1029. End Sub
  1030. Sub MenuBrowseRecords_Click ()
  1031. Dim ds As dynaset
  1032. 'save records if something has changed only if command1
  1033. 'is visible
  1034. If Command1(0).Visible Then
  1035.     UpdateTheRecord
  1036. End If
  1037. SkipIt = True
  1038. SearchFlag = False
  1039. MenuSearchRecords.Enabled = True
  1040. MenuBrowseRecords.Enabled = False
  1041. 'reset the recordsource and refresh to original recordset
  1042. Data1.RecordSource = "Select * From Addresses Order by tAlpha"
  1043. Data1.Refresh
  1044. 'if empty then go to add mode
  1045. If Data1.Recordset.BOF And Data1.Recordset.EOF Then
  1046.     Beep
  1047.     MsgBox "No Records to Browse. Going to Add Mode.", 16, ErrorMsg
  1048.     MenuAddRecord_Click
  1049.     UpdateMyList
  1050.     List1.ListIndex = 0
  1051.     List2.ListIndex = 0
  1052.     Set ds = Data1.Recordset.Clone()
  1053.     ds.MoveLast
  1054.     TotRec = ds.RecordCount
  1055.     ds.Close
  1056.     MyRec = 1
  1057.     Data1.Caption = "Record " & CStr(MyRec) & " of " & CStr(TotRec)
  1058.     If Label14.Caption <> "" Then
  1059.         Command3D3.Enabled = True
  1060.     Else
  1061.         Command3D3.Enabled = False
  1062.     End If
  1063. End If
  1064. SkipIt = False
  1065. End Sub
  1066. Sub MenuClear_Click ()
  1067. 'delete some text and set for update
  1068. Screen.ActiveControl.SelText = ""
  1069. SetUpdate
  1070. End Sub
  1071. Sub MenuCompact_Click ()
  1072. Dim ds As dynaset
  1073. 'we can change the form size by setting the oksize flag
  1074. 'we do this so someone doesn't start click controls on
  1075. 'the main form while we are compacting
  1076. OkSize = True
  1077. Address.Height = 200
  1078. Standby.Show
  1079. Standby.Refresh
  1080. Data1.Database.Close    'VERY IMPORTANT
  1081. cSource$ = ThePath & "Address.mdb"
  1082. cDest$ = ThePath & "NAddress.mdb"
  1083. On Error Resume Next
  1084. CompactDatabase cSource$, cDest$
  1085. If Err Then
  1086.     Beep
  1087.     MsgBox "Unable to Compact DataBase.", 16, ErrorMsg
  1088.     On Error GoTo 0
  1089.     GoTo cReload
  1090. End If
  1091. On Error GoTo 0
  1092. Kill cSource$
  1093. Name cDest$ As cSource$
  1094. cReload:
  1095. 'reload the database
  1096. Data1.DatabaseName = DBName
  1097. Data1.RecordSource = "Select * From Addresses Order by tAlpha"
  1098. SkipIt = True
  1099. Command3D2.Visible = False
  1100. Command3D1.Visible = False
  1101. Data1.Refresh
  1102. If Data1.Recordset.BOF And Data1.Recordset.EOF Then
  1103.     MenuAddRecord_Click
  1104.     UpdateMyList
  1105.     List1.ListIndex = 0
  1106.     List2.ListIndex = 0
  1107.     Set ds = Data1.Recordset.Clone()
  1108.     ds.MoveLast
  1109.     TotRec = ds.RecordCount
  1110.     ds.Close
  1111.     MyRec = 1
  1112.     Data1.Caption = "Record " & CStr(MyRec) & " of " & CStr(TotRec)
  1113.     MenuBrowseRecords.Enabled = False
  1114.     If Label14.Caption = "" Then
  1115.         Command3D3.Enabled = False
  1116.     End If
  1117. End If
  1118. SkipIt = False
  1119. 'resize form back and keep the user out of it
  1120. OkSize = False
  1121. Address.Height = 6045
  1122. Unload Standby
  1123. End Sub
  1124. Sub MenuCopy_Click ()
  1125. Clipboard.Clear
  1126. Clipboard.SetText Screen.ActiveControl.SelText
  1127. End Sub
  1128. Sub MenuCopyAddress_Click ()
  1129. TheString$ = ""
  1130. TheString$ = Trim$(Text1.Text) & Chr$(13) & Chr$(10)
  1131. If Trim$(Text2.Text) <> "" Then
  1132.     TheString$ = TheString$ & Trim$(Text2.Text) & Chr$(13) & Chr$(10)
  1133. End If
  1134. If Trim$(Text3.Text) <> "" Then
  1135.     TheString$ = TheString$ & Trim$(Text3.Text) & Chr$(13) & Chr$(10)
  1136. End If
  1137. If Trim$(Text4.Text) <> "" Then
  1138.     TheString$ = TheString$ & Trim$(Text4.Text) & ", " & Trim$(Text5.Text)
  1139.     TheString$ = TheString$ & " " & Trim$(Text6.Text) & " " & Trim$(Text10.Text) & Chr$(13) & Chr$(10)
  1140. End If
  1141. If Trim$(Text7.Text) <> "" Then
  1142.     TheString$ = TheString$ & Trim$(Text7.Text) & Chr$(13) & Chr$(10)
  1143. End If
  1144. Clipboard.Clear
  1145. Clipboard.SetText TheString$
  1146. End Sub
  1147. Sub MenuCut_Click ()
  1148. MenuCopy_Click
  1149. Screen.ActiveControl.SelText = ""
  1150. SetUpdate
  1151. End Sub
  1152. Sub MenuDeleteRecord_Click ()
  1153. CommandOff
  1154. For i% = 0 To List1.ListCount - 1    'Make sure index set right
  1155.     If List1.List(i%) = CStr(Data1.Recordset!ID) Then
  1156.         List1.ListIndex = i%
  1157.         List2.ListIndex = i%
  1158.         Exit For
  1159.      End If
  1160. Next i%
  1161. List1.RemoveItem List1.ListIndex
  1162. List2.RemoveItem List2.ListIndex
  1163. xx$ = Label14.Caption
  1164. On Error Resume Next
  1165. Kill xx$
  1166. Data1.Recordset.Delete
  1167. Data1.Recordset.MoveNext
  1168. If Data1.Recordset.EOF Then
  1169.     On Local Error GoTo cDelErr 'this required if last record deleted
  1170.     Data1.Recordset.MovePrevious
  1171. End If
  1172. Exit Sub
  1173. cDelErr:
  1174.     If Err = 3021 Then
  1175.         If SearchFlag = False Then
  1176.             Beep
  1177.             MsgBox "Last Recorded in Database Deleted.", 16, ErrorMsg
  1178.             MenuAddRecord_Click
  1179.             Resume cDelEnd
  1180.         Else
  1181.             Beep
  1182.             MsgBox "Last Record in Search Deleted. Returning to Browse Mode.", 16, ErrorMsg
  1183.             MenuBrowseRecords_Click
  1184.             Resume cDelEnd
  1185.         End If
  1186.     Else
  1187.         Resume cDelEnd
  1188.     End If
  1189. cDelEnd:
  1190. End Sub
  1191. Sub MenuDeleteVoice_Click ()
  1192. 'obvious
  1193. X$ = Label14.Caption
  1194. Label14.Caption = ""
  1195. Command3D3.Enabled = False
  1196. On Error Resume Next
  1197. Kill X$
  1198. On Error GoTo 0
  1199. End Sub
  1200. Sub MenuDial_Click ()
  1201. 'check the port form ini file. note if user has not used
  1202. 'setup at least once he or she will be told to
  1203. Default$ = "NOPORT"
  1204. INIFile$ = ThePath & "ADDRESS.INI"
  1205. TC$ = GetPPKeyString$("Phone", "Port", Default$, INIFile$)
  1206. If TC$ = "NOPORT" Then
  1207.     Beep
  1208.     MsgBox "You Must SetUp a Comm Port.", 16, ErrorMsg
  1209.     Exit Sub
  1210. End If
  1211. TheComm = CInt(TC$) 'thecomm is a global variable
  1212. 'check callstring for bad characters
  1213. CheckString$ = "1234567890()-,"
  1214. BadNum% = False
  1215. For i% = 1 To Len(CallString)
  1216.     a$ = Mid$(CallString, i%, 1)
  1217.     If InStr(CheckString$, a$) = 0 Then
  1218.         Beep
  1219.         MsgBox "Selected Number is Incorrect.", 16, ErrorMsg
  1220.         BadNum% = True
  1221.         Exit For
  1222.     End If
  1223. Next i%
  1224. If BadNum% Then Exit Sub
  1225. Dial.Text1.Text = CallString
  1226. Dial.Show 1
  1227. End Sub
  1228. Sub MenuEdit_Click ()
  1229. 'make sure only the right menu items are enabled
  1230. MenuCut.Enabled = True
  1231. MenuCopy.Enabled = True
  1232. MenuPaste.Enabled = False
  1233. MenuClear.Enabled = True
  1234. MenuCopyAddress.Enabled = True
  1235. If TypeOf Screen.ActiveControl Is TextBox Then
  1236.     If Clipboard.GetFormat(1) Then MenuPaste.Enabled = True
  1237.     If Screen.ActiveControl.SelText = "" Then
  1238.         MenuCut.Enabled = False
  1239.         MenuCopy.Enabled = False
  1240.         MenuClear.Enabled = False
  1241.     End If
  1242.     MenuCut.Enabled = False
  1243.     MenuCopy.Enabled = False
  1244.     MenuClear.Enabled = False
  1245. End If
  1246. End Sub
  1247. Sub MenuExit_Click ()
  1248. Unload Address
  1249. End Sub
  1250. Sub MenuNameList_Click ()
  1251. Dim ds As dynaset
  1252. PrintX.Show
  1253. Set ds = Data1.Recordset.Clone()
  1254. MaxRows% = Int(Printer.Height / Printer.TextHeight("T"))
  1255. MaxRows% = MaxRows% - 5
  1256. Printer.Print "Mike's Address Name List"
  1257. Printer.Print String$(35, "=")
  1258. PrintedRows% = 0
  1259. Do While Not ds.EOF
  1260.     If IsNull(ds("tName")) Then 'watch out for
  1261.         Printer.Print "XXXXXX"  'and substitute
  1262.     Else
  1263.         Printer.Print ds("tName")
  1264.     End If
  1265.     DoEvents
  1266.     If PrintCancel Then Exit Do
  1267.     PrintedRows% = PrintedRows% + 1
  1268.     If PrintedRows% = MaxRows% Then
  1269.         Printer.NewPage
  1270.         Printer.Print "Mike's Address Name List"
  1271.         Printer.Print String$(35, "=")
  1272.         PrintedRows% = 0
  1273.     End If
  1274.     ds.MoveNext
  1275. Printer.EndDoc
  1276. ds.Close
  1277. Unload PrintX
  1278. End Sub
  1279. Sub MenuOneList_Click ()
  1280. Dim ds As dynaset
  1281. PrintX.Show
  1282. Set ds = Data1.Recordset.Clone()
  1283. MaxRows% = Int(Printer.Height / Printer.TextHeight("T"))
  1284. MaxRows% = MaxRows% - 5
  1285. Printer.Print "Mike's Address Name & Phone List"
  1286. Printer.Print String$(75, "=")
  1287. PrintedRows% = 0
  1288. Do While Not ds.EOF
  1289.     If IsNull(ds("tName")) Then
  1290.         Printer.Print "XXXXXX"; String$(40 - 6, ".");
  1291.     Else
  1292.         Printer.Print ds("tName"); String$(40 - Len(ds("tName")), ".");
  1293.     End If
  1294.     If IsNull(ds("tPhone")) Then
  1295.         Printer.Print " "
  1296.     Else
  1297.         Printer.Print (ds("tPhone"))
  1298.     End If
  1299.     DoEvents
  1300.     If PrintCancel Then Exit Do
  1301.     PrintedRows% = PrintedRows% + 1
  1302.     If PrintedRows% = MaxRows% Then
  1303.         Printer.NewPage
  1304.         Printer.Print "Mike's Address Name & Phone List"
  1305.         Printer.Print String$(75, "=")
  1306.         PrintedRows% = 0
  1307.     End If
  1308.     ds.MoveNext
  1309. Printer.EndDoc
  1310. ds.Close
  1311. Unload PrintX
  1312. End Sub
  1313. Sub MenuPaste_Click ()
  1314. Screen.ActiveControl.SelText = Clipboard.GetText()
  1315. SetUpdate
  1316. End Sub
  1317. Sub MenuPhone_Click ()
  1318. MenuDial.Enabled = False
  1319. 'make sure we have a good callstring selected before we
  1320. 'allow a call to be dialed
  1321. If TypeOf Screen.ActiveControl Is TextBox Then
  1322.     If Trim$(Screen.ActiveControl.SelText) <> "" Then
  1323.         CallString = Screen.ActiveControl.SelText
  1324.         CallString = Trim$(CallString)
  1325.         MenuDial.Enabled = True
  1326.     End If
  1327. End If
  1328. End Sub
  1329. Sub MenuRecordVoice_Click ()
  1330. RecordIt.Show 1
  1331. If RecordIt.Tag = "NO" Then
  1332.     Beep
  1333.     MsgBox "Unable to Complete Recording.", 16, ErrorMsg
  1334. End If
  1335. If Label14.Caption <> "" Then
  1336.     Command3D3.Enabled = True
  1337.     Command3D3.Enabled = False
  1338. End If
  1339. Unload RecordIt
  1340. End Sub
  1341. Sub MenuSearchRecords_Click ()
  1342. Dim ds As dynaset
  1343. If Command1(0).Visible Then
  1344.     UpdateTheRecord
  1345. End If
  1346. CommandOff
  1347. CurrRec = Data1.Recordset!ID
  1348. Search.Show 1
  1349. 'this is one heck of a way to do things
  1350. If Search.Tag = "YES" Then
  1351.     ThePattern$ = Trim$(Search.Text1.Text)
  1352.     FilterString ThePattern$
  1353.     ThePattern$ = " '*" & ThePattern$ & "*' OR "
  1354.     SQLQ$ = "SELECT * FROM Addresses WHERE "
  1355.     cFilter$ = ""
  1356.     If Search.Check3D1.Value Then
  1357.         cFilter$ = cFilter$ & "tName LIKE" & ThePattern$
  1358.     End If
  1359.     If Search.Check3D2.Value Then
  1360.         cFilter$ = cFilter$ & "tStreet1 LIKE" & ThePattern$ & "tStreet2 LIKE" & ThePattern$
  1361.     End If
  1362.     If Search.Check3D3.Value Then
  1363.         cFilter$ = cFilter$ & "tCity LIKE" & ThePattern$
  1364.     End If
  1365.     If Search.Check3D4.Value Then
  1366.         cFilter$ = cFilter$ & "tState LIKE" & ThePattern$
  1367.     End If
  1368.     If Search.Check3D5.Value Then
  1369.         cFilter$ = cFilter$ & "tZip LIKE" & ThePattern$
  1370.     End If
  1371.     If Search.Check3D6.Value Then
  1372.         cFilter$ = cFilter$ & "tRegion LIKE" & ThePattern$
  1373.     End If
  1374.     If Search.Check3D7.Value Then
  1375.         cFilter$ = cFilter$ & "tMessage LIKE" & ThePattern$
  1376.     End If
  1377.     If Search.Check3D8.Value Then
  1378.         cFilter$ = cFilter$ & "tInfo LIKE" & ThePattern$
  1379.     End If
  1380.     If Search.Check3D9.Value Then
  1381.         cFilter$ = cFilter$ & "tPhone LIKE" & ThePattern$
  1382.     End If
  1383.     cFilter$ = Left$(cFilter$, Len(cFilter$) - 3)
  1384.     SQLQ$ = SQLQ$ & cFilter$ & " ORDER BY tAlpha"
  1385.     Data1.RecordSource = SQLQ$
  1386.     SkipIt = True
  1387.     Data1.Refresh
  1388.     If Data1.Recordset.BOF And Data1.Recordset.EOF Then
  1389.         Beep
  1390.         Msg$ = "Search String " & Search.Text1.Text & " Not Found."
  1391.         MsgBox Msg$, 16, ErrorMsg
  1392.         Data1.RecordSource = "Select * From Addresses Order by tAlpha"
  1393.         Data1.Refresh
  1394.         UpdateMyList
  1395.         SkipIt = False
  1396.         Data1.Recordset.FindFirst "ID = " & CStr(CurrRec)
  1397.         If Label14.Caption <> "" Then
  1398.             Command3D3.Enabled = True
  1399.         Else
  1400.             Command3D3.Enabled = False
  1401.         End If
  1402.     Else
  1403.         SearchFlag = True
  1404.         MenuSearchRecords.Enabled = False
  1405.         MenuBrowseRecords.Enabled = True
  1406.         UpdateMyList
  1407.         List1.ListIndex = 0
  1408.         List2.ListIndex = 0
  1409.         Set ds = Data1.Recordset.Clone()
  1410.         ds.MoveLast
  1411.         TotRec = ds.RecordCount
  1412.         ds.Close
  1413.         MyRec = 1
  1414.         Data1.Caption = "Record " & CStr(MyRec) & " of " & CStr(TotRec)
  1415.         If Label14.Caption <> "" Then
  1416.             Command3D3.Enabled = True
  1417.         Else
  1418.             Command3D3.Enabled = False
  1419.         End If
  1420.         SkipIt = False
  1421.     End If
  1422.     If Search.Tag = "NO" Then
  1423.         Beep
  1424.         MsgBox "Illegal Search Criteria !!!", 16, ErrorMsg
  1425.     End If
  1426. End If
  1427. Unload Search
  1428. End Sub
  1429. Sub MenuSetup_Click ()
  1430. Setup.Show 1
  1431. End Sub
  1432. Sub MenuTwoList_Click ()
  1433. Dim ds As dynaset
  1434. PrintX.Show
  1435. Set ds = Data1.Recordset.Clone()
  1436. MaxRows% = Int(Printer.Height / Printer.TextHeight("T"))
  1437. MaxRows% = (MaxRows% - 5) \ 3
  1438. Printer.Print "Mike's Address Name & Phone List"
  1439. Printer.Print String$(35, "=")
  1440. PrintedRows% = 0
  1441. Do While Not ds.EOF
  1442.     If IsNull(ds("tName")) Then
  1443.         Printer.Print "XXXXXX"
  1444.     Else
  1445.         Printer.Print ds("tName")
  1446.     End If
  1447.     If IsNull(ds("tPhone")) Then
  1448.         Printer.Print " "
  1449.     Else
  1450.         Printer.Print ds("tPhone")
  1451.     End If
  1452.     Printer.Print String$(35, "_")
  1453.     DoEvents
  1454.     If PrintCancel Then Exit Do
  1455.     PrintedRows% = PrintedRows% + 1
  1456.     If PrintedRows% = MaxRows% Then
  1457.         Printer.NewPage
  1458.         Printer.Print "Mike's Address Name & Phone List"
  1459.         Printer.Print String$(35, "=")
  1460.         PrintedRows% = 0
  1461.     End If
  1462.     ds.MoveNext
  1463. Printer.EndDoc
  1464. ds.Close
  1465. Unload PrintX
  1466. End Sub
  1467. Sub MenuVoice_Click ()
  1468. 'delete only available if label14 has caption
  1469. If Label14.Caption = "" Then
  1470.     MenuDeleteVoice.Enabled = False
  1471.     MenuDeleteVoice.Enabled = True
  1472. End If
  1473. End Sub
  1474. Sub SetUpdate ()
  1475. 'If someone has changed something then use our buttons
  1476. 'and not the data control's. This assures that we keep
  1477. 'the database in correct order.
  1478. If Data1.EditMode = 2 Then Exit Sub
  1479. If AlreadySet Then Exit Sub
  1480. For i% = 0 To 3
  1481.     Command1(i%).Visible = True
  1482. Next i%
  1483. Data1.Enabled = False
  1484. AlreadySet = True
  1485. End Sub
  1486. Sub Text1_KeyDown (KeyCode As Integer, Shift As Integer)
  1487. 'need to set update if char deleted
  1488. If KeyCode = 46 Then    'delete key hit
  1489.     SetUpdate
  1490. End If
  1491. End Sub
  1492. Sub Text1_KeyPress (KeyAscii As Integer)
  1493. 'cr=tab
  1494. If KeyAscii = 13 Then
  1495.     KeyAscii = 0
  1496.     SendKeys "{TAB}"
  1497.     Exit Sub
  1498. End If
  1499. 'set for update something has changed
  1500. SetUpdate
  1501. End Sub
  1502. Sub Text10_KeyDown (KeyCode As Integer, Shift As Integer)
  1503. If KeyCode = 46 Then    'delete key hit
  1504.     SetUpdate
  1505. End If
  1506. End Sub
  1507. Sub Text10_KeyPress (KeyAscii As Integer)
  1508. If KeyAscii = 13 Then
  1509.     KeyAscii = 0
  1510.     SendKeys "{TAB}"
  1511.     Exit Sub
  1512. End If
  1513. SetUpdate
  1514. End Sub
  1515. Sub Text11_KeyDown (KeyCode As Integer, Shift As Integer)
  1516. If KeyCode = 46 Then    'delete key hit
  1517.     SetUpdate
  1518. End If
  1519. End Sub
  1520. Sub Text11_KeyPress (KeyAscii As Integer)
  1521. If KeyAscii = 13 Then
  1522.     KeyAscii = 0
  1523.     SendKeys "{TAB}"
  1524.     Exit Sub
  1525. End If
  1526. SetUpdate
  1527. End Sub
  1528. Sub Text2_KeyDown (KeyCode As Integer, Shift As Integer)
  1529. If KeyCode = 46 Then    'delete key hit
  1530.     SetUpdate
  1531. End If
  1532. End Sub
  1533. Sub Text2_KeyPress (KeyAscii As Integer)
  1534. If KeyAscii = 13 Then
  1535.     KeyAscii = 0
  1536.     SendKeys "{TAB}"
  1537.     Exit Sub
  1538. End If
  1539. SetUpdate
  1540. End Sub
  1541. Sub Text3_KeyDown (KeyCode As Integer, Shift As Integer)
  1542. If KeyCode = 46 Then    'delete key hit
  1543.     SetUpdate
  1544. End If
  1545. End Sub
  1546. Sub Text3_KeyPress (KeyAscii As Integer)
  1547. If KeyAscii = 13 Then
  1548.     KeyAscii = 0
  1549.     SendKeys "{TAB}"
  1550.     Exit Sub
  1551. End If
  1552. SetUpdate
  1553. End Sub
  1554. Sub Text4_KeyDown (KeyCode As Integer, Shift As Integer)
  1555. If KeyCode = 46 Then    'delete key hit
  1556.     SetUpdate
  1557. End If
  1558. End Sub
  1559. Sub Text4_KeyPress (KeyAscii As Integer)
  1560. If KeyAscii = 13 Then
  1561.     KeyAscii = 0
  1562.     SendKeys "{TAB}"
  1563.     Exit Sub
  1564. End If
  1565. SetUpdate
  1566. End Sub
  1567. Sub Text5_KeyDown (KeyCode As Integer, Shift As Integer)
  1568. If KeyCode = 46 Then    'delete key hit
  1569.     SetUpdate
  1570. End If
  1571. End Sub
  1572. Sub Text5_KeyPress (KeyAscii As Integer)
  1573. If KeyAscii = 13 Then
  1574.     KeyAscii = 0
  1575.     SendKeys "{TAB}"
  1576.     Exit Sub
  1577. End If
  1578. SetUpdate
  1579. End Sub
  1580. Sub Text6_KeyDown (KeyCode As Integer, Shift As Integer)
  1581. If KeyCode = 46 Then    'delete key hit
  1582.     SetUpdate
  1583. End If
  1584. End Sub
  1585. Sub Text6_KeyPress (KeyAscii As Integer)
  1586. If KeyAscii = 13 Then
  1587.     KeyAscii = 0
  1588.     SendKeys "{TAB}"
  1589.     Exit Sub
  1590. End If
  1591. SetUpdate
  1592. End Sub
  1593. Sub Text7_KeyDown (KeyCode As Integer, Shift As Integer)
  1594. If KeyCode = 46 Then    'delete key hit
  1595.     SetUpdate
  1596. End If
  1597. End Sub
  1598. Sub Text7_KeyPress (KeyAscii As Integer)
  1599. If KeyAscii = 13 Then
  1600.     KeyAscii = 0
  1601.     SendKeys "{TAB}"
  1602.     Exit Sub
  1603. End If
  1604. SetUpdate
  1605. End Sub
  1606. Sub Text8_KeyDown (KeyCode As Integer, Shift As Integer)
  1607. If KeyCode = 46 Then    'delete key hit
  1608.     SetUpdate
  1609. End If
  1610. End Sub
  1611. Sub Text8_KeyPress (KeyAscii As Integer)
  1612. If KeyAscii = 13 Then
  1613.     KeyAscii = 0
  1614.     SendKeys "{TAB}"
  1615.     Exit Sub
  1616. End If
  1617. SetUpdate
  1618. End Sub
  1619. Sub Text9_KeyDown (KeyCode As Integer, Shift As Integer)
  1620. If KeyCode = 46 Then    'delete key hit
  1621.     SetUpdate
  1622. End If
  1623. End Sub
  1624. Sub Text9_KeyPress (KeyAscii As Integer)
  1625. If KeyAscii = 13 Then
  1626.     KeyAscii = 0
  1627.     SendKeys "{TAB}"
  1628.     Exit Sub
  1629. End If
  1630. SetUpdate
  1631. End Sub
  1632. Sub Timer1_Timer ()
  1633. 'if voice file is playing then keep checking. when done
  1634. 'then close things out and turn the timer off
  1635. Stat$ = "status talk mode"
  1636. Mlen% = 255
  1637. Msg$ = String$(255, 0)
  1638. Ret& = mciSendString(Stat$, Msg$, Mlen%, Address.hWnd)
  1639. If InStr(Msg$, "playing") = 0 Then
  1640.     X% = MMSend%("close talk")
  1641.     If Label14.Caption <> "" Then
  1642.         Command3D3.Enabled = True
  1643.     End If
  1644.     MenuVoice.Enabled = True
  1645.     Timer1.Enabled = False
  1646. End If
  1647. End Sub
  1648. Sub UpdateMyList ()
  1649. 'Lets refresh the list box. Note we must watch out for
  1650. 'records with NUL tName field and substitute xxxxxx.
  1651. Dim ds As dynaset
  1652. List1.Clear
  1653. List2.Clear
  1654. Set ds = Data1.Recordset.Clone()
  1655. 'ds.MoveFirst 'not needed problem with one record left
  1656. Do While Not ds.EOF
  1657.     List1.AddItem CStr(ds("ID"))
  1658.     If IsNull(ds("tName")) Then
  1659.         List2.AddItem "XXXXXX"
  1660.     Else
  1661.         List2.AddItem ds("tName")
  1662.     End If
  1663.     ds.MoveNext
  1664. ds.Close
  1665. End Sub
  1666. Sub UpdateTheRecord ()
  1667. 'We update the record and refresh data1 to bring back
  1668. 'the order we want. Note that we try to come back to the
  1669. 'record we had before refresh. Also we update the date
  1670. 'for the record here.
  1671. Label11.Caption = Date$
  1672. Data1.Recordset.Update
  1673. If Data1.EditMode = 0 Then
  1674.     CurrRec = Data1.Recordset!ID
  1675.     Data1.Refresh
  1676.     UpdateMyList
  1677.     Data1.Recordset.FindFirst "ID =" & CStr(CurrRec)
  1678.     Data1.UpdateControls
  1679. End If
  1680. CommandOff
  1681. Data1.Enabled = True
  1682. End Sub
  1683.